<template>
	<view class="">
		<view class="detail_banner"><image :src="active_info.cover" mode=""></image></view>
		<!-- 赛事名称 -->
		<view class="detail_name">
			<view class="title">
				<span v-if="active_info.is_official">官方</span>
				{{ active_info.name }}
			</view>
			<view class="group">
				<view class="group_l">
					{{ active_info.club_name }}
					<image v-if="active_info.club_cation" src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/other/group_logo.png" mode=""></image>
				</view>
				<view class="group_r flex">
					<view class="ll">
						<image class="ll_pic" src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/detail_eye.png" mode=""></image>
						{{ active_info.browse }}
					</view>
					<view class="fx">
						<!-- <i class="icon">&#xe614;</i> -->
						<image class="fx_pic" src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/detail_share02.png" mode=""></image>
						{{ active_info.share }}
					</view>
				</view>
			</view>
		</view>
		<!-- 赛事进度条 -->
		<view class="progress_bar">
			<view class="start">
				<view class="start_one" v-if="nowTime > singup_start_time">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/starttime.png" mode=""></image>
					<view class="info">报名开始</view>
					<view class="date">{{ active_info.sign_up_start_m }}</view>
				</view>
				<view class="start_one" v-else>
					<!-- <image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/progress01.png" mode="widthFix"></image> -->
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/newPicter/singup01.png" mode=""></image>
					<view class="info">报名开始</view>
					<view class="date">{{ active_info.sign_up_start_m }}</view>
				</view>
			</view>
			<!-- <view class="lineone line"><image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/index_jt.png" mode=""></image></view> -->
			<view class="linetwo"><image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/index_jt.png" mode=""></image></view>
			<view class="end">
				<view class="end_one" v-if="nowTime > singup_end_time">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/progress12.png" mode=""></image>
					<view class="info">报名截止</view>
					<view class="date">{{ active_info.sign_up_end_m }}</view>
				</view>
				<view class="end_one" v-else>
					<!-- <image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/endtime.png" mode="widthFix"></image> -->
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/newPicter/singup02.png" mode=""></image>
					<view class="info">报名截止</view>
					<view class="date">{{ active_info.sign_up_end_m }}</view>
				</view>
			</view>
			<view class="linetwo"><image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/index_jt.png" mode=""></image></view>
			<view class="began">
				<view class="" v-if="nowTime > start_time">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/progress13.png" mode="widthFix"></image>
					<view class="info">{{ ac_status }}</view>
					<view class="date">{{ active_info.start_time_m }}</view>
				</view>
				<view class="" v-else>
					<!-- <image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/start.png" mode="widthFix"></image> -->
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/newPicter/singup03.png" mode=""></image>
					<view class="info">{{ ac_status }}</view>
					<view class="date">{{ active_info.start_time_m }}</view>
				</view>
			</view>
		</view>
		<!-- 分割线 -->
		<view class="line"></view>
		<!-- 报名参赛人员 -->
		<view class="participant" @click="toparticipant(active_info.type)">
			<view class="participant_left">
				<view class="participant_left_img" :style="{width: peopleWidth}">
					<image v-for="(item, index) in singupPeople" :src="item.head_url" mode="" :style="'left:' + 40 * index + 'rpx'"></image>
					<!-- :style="'left:'+(12+ 100 * parent_index)+'upx'" -->
					<image
						v-if="singupPeople_people > 5"
						src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/member03.png"
						mode=""
						:style="'left:' + 40 * singupPeople.length + 'rpx'"
					></image>
				</view>
				<span class="participant_left_i" v-if="singupPeople_people > 0 ">已有{{ singupPeople_people }}人报名参加</span>
				<span v-else>暂时没有人参加活动</span>
			</view>
			<i class="icon">&#xe637;</i>
		</view>
		<!-- 赛事信息 -->
		<view class="detail_message">
			<view class="title">基本信息</view>
			<view class="detail_info_m">
				<view class="date">
					<span>{{ type }}时间</span>
					<view class="date_time">{{ active_info.start_time_b }}至{{ active_info.end_time_b }}</view>
				</view>
				<view class="area" @click="tolookmap(active_info.latitude, active_info.longitude)">
					<view class="area_left ">
						<span>{{ type }}地址</span>
						<view class="date_time shenglueh">{{ active_info.address }}</view>
					</view>
					<view class="area_right"><i class="icon">&#xe672;</i></view>
				</view>
				<!-- 范围 -->
				<view class="scope">
					<span>报名范围</span>
					<view class="date_time" v-if="active_info.active_limit == -1">所有人</view>
					<view class="date_time" v-else-if="active_info.active_limit == 0">跑团成员</view>
					<view class="date_time" v-else>高级会员</view>
				</view>
				<view class="peoplenum">
					<span>人数限制</span>
					<view class="date_time">{{ limitPeople }}/{{ sinup_people }}</view>
				</view>
			</view>
		</view>
		<!-- 分割线 -->
		<view class="line"></view>
		<!-- 详情 相册 评论 费用 -->
		<view class="detail_nav">
			<view class="detail_nav_item" v-for="(item, index) in navList" :key="index" @click="check(index)">
				<view :class="['detail_nav_item_name', border_index == index ? 'detail_nav_item_name_a' : '']">{{ item.name }}</view>
				<view v-if="border_index == index" class="detail_nav_item_line"></view>
			</view>
		</view>
		<!-- 选项表 -->
		<particulars v-if="border_index == 0" :detail="active_info.detail"></particulars>
		<photo v-else-if="border_index == 1" @tophotodetail="tophotodetail" :photoid="active_info.id"></photo>
		<comment v-else @todiscuss="todiscuss(active_id)" :headImg="headImg" :commentId="active_info.id" :runname="active_info.club_name"></comment>
		<!-- 底部导航栏 -->
		<view class="bottom_nav">
			<view class="bottom_navleft">
				<view class="share" @click="toshare">
					<!-- <i class="icon">&#xe632;</i> -->
					<!-- <image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/detail_share.png" mode="widthFix"></image> -->
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/newPicter/share.png" mode="widthFix"></image>
					<span>分享</span>
				</view>
				<!-- 活动任务 赛事按钮 -->
				<view class="three">
					<view class="grade" @click="tograde" v-if="active_info.type == 1">
						<!-- <i class="icon">&#xe6eb;</i> -->
						<!-- <image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/detail_ckcj.png" mode=""></image> -->
						<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/newPicter/cjcx.png" mode=""></image>
						<span>成绩查询</span>
					</view>
					<view class="grade" @click="totask" v-else-if="active_info.type == 2">
						<image class="active_tj" src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/detail_tj.png" mode=""></image>
						<span>活动统计</span>
					</view>
					<view class="grade" @click="torwresult" v-else-if="active_info.type == 3">
						<image class="active_result" src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/othertwo/detail_result.png" mode=""></image>
						<span>结果公告</span>
					</view>
				</view>
			</view>
			<view class="" v-if="singupPeople_people != sinup_people && vip_rank >= active_info.active_limit_n">
				<view v-if="active_info.state == 2 && !active_info.is_sign && nowTime < singup_end_time && nowTime > singup_start_time" class="apply" @click="tosingup">
					立即报名
				</view>
				<view v-else-if="nowTime > singup_end_time" class="apply apply_no">报名结束</view>
				<view v-else-if="active_info.is_sign == 1" class="apply " @tap="toorderpay">待支付</view>
				<view v-else-if="active_info.is_sign == 2" class="apply ">已报名</view>
				<view v-else-if="active_info.state == 4" class="apply apply_no">冻结</view>
				<view v-else-if="active_info.state == 2 && nowTime < singup_start_time" class="apply apply_no">报名未开始</view>
				<view v-else-if="active_info.state == 3" class="apply apply_no">报名暂停</view>
			</view>
			<!-- <view v-else-if="singupPeople_people == sinup_people" class="apply apply_no">名额已满</view> -->
			<view v-else-if="singupPeople_people == sinup_people">
				<view class="apply" v-if="active_info.is_sign == 2">已报名</view>
				<view class="apply apply_no" v-else>名额已满</view>
			</view>
			<view v-else-if="vip_rank < active_info.active_limit_n" class="apply apply_no">立即报名</view>
		</view>
		<uni-popup ref="popup" type="bottom" class="pppppppppp">
			<view class="clo" @click="$refs.popup.close()"><i class="icon">&#xe61d;</i></view>
			<view class="singup_item">组别名称</view>
			<view :class="['ta_contant', group_index == 10 ? 'ta_contant_c' : '']">
				<view
					:class="['task_content', group_index == index ? 'task_content_c' : '', group_index == index && numOfPeople ? 'task_content_c_c' : '']"
					@tap="changegroup(index, item.id)"
					v-for="(item, index) in group_list"
				>
					<view class="task_content_item">
						<view class="title">
							<view class="top">
								{{ item.name }}
								<text v-if="item.allpeople_num > item.people_num && item.people_num">({{ item.people_num }}-{{ item.allpeople_num }})</text>
							</view>
						</view>
						<!-- 早鸟价 -->
						<view class="price" v-if="item.is_shift && nowTime > singup_start_time && nowTime < item.shift_time * 1000">￥{{ item.shift_price }}</view>
						<!-- 会员价 -->
						<view class="price" v-else-if="(item.is_shift && vip_rank == 2 && nowTime > item.shift_time * 1000) || (!item.is_shift && vip_rank == 2)">
							<view class="" v-if="item.vip_price > 0">￥{{ item.vip_price }}</view>
							<view class="" v-else>免费</view>
						</view>
						<view class="price" v-else="(!item.is_shift && !vip_rank) || (item.is_shift && !vip_rank && nowTime > item.shift_time * 1000)">
							<view class="" v-if="item.normal_price > 0">￥{{ item.normal_price }}</view>
							<view class="" v-else>免费</view>
						</view>
					</view>
					<view class="task_content_bot" v-if="item.is_verify">
						<view class="left">审</view>
						<view class="right">报名成功后需人工审核，若未通过费用则原路返回</view>
					</view>
					<!-- 早鸟价 -->
					<view class="morning" v-if="item.is_shift && nowTime > singup_start_time && nowTime < item.shift_time * 1000">
						早鸟价
						<view class="jt"></view>
					</view>
					<view class="morning" v-if="(item.is_shift && vip_rank == 2 && nowTime > item.shift_time * 1000) || (!item.is_shift && vip_rank == 2 && item.is_pay)">
						会员价
						<view class="jt"></view>
					</view>
					<!-- 审核提示 -->
					<view class="sinup_shen" v-if="item.is_verify"><image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/other/sinup_shen.png" mode=""></image></view>
					<!-- 选择 -->
					<view class="sinup_gou"><image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/other/sinup_gou.png" mode=""></image></view>
				</view>
			</view>
			<view class="task_btn" v-if="group_index != 10">
				<view class="price" v-if="singup_money != '0.00' && singup_money">
					<view class="" v-if="singup_money != '免费'">￥{{ singup_money }}</view>
					<view class="" v-else>{{ singup_money }}</view>
				</view>

				<view v-if="numOfPeople" class="bm bm_t">名额已满</view>
				<view v-else-if="!numOfPeople && singup_flag" class="bm" @tap="tosingupmessage(active_id, group_index, singup_money)">立即报名</view>
				<view v-else-if="!numOfPeople" class="bm bm_t">立即报名</view>
			</view>
		</uni-popup>
		<!-- 分享弹窗 -->
		<uni-popupt ref="sharepopup" type="bottom">
			<view class="sharepop_title">通过以下方式邀请朋友</view>
			<view class="sharepop_contant">
				<view class="wechat" @tap="shareFriend">
					<button open-type="share">
						<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/wechat.png" mode="widthFix"></image>
						<view class="tit">微信好友</view>
					</button>
				</view>
				<view class="wechat" @click="tofriendban(active_id)">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/friend.png" mode="widthFix"></image>
					<view class="tit">分享朋友圈海报</view>
				</view>
				<view class="wechat" @click="tosociety">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/public.png" mode="widthFix"></image>
					<view class="tit">嵌入公众号</view>
				</view>
				<view class="wechat" @tap="copy">
					<image src="https://ykp-new.oss-cn-hangzhou.aliyuncs.com/client/index/copy.png" mode="widthFix"></image>
					<view class="tit">复制链接</view>
				</view>
			</view>
			<view class="sharepop_close" @click="sharepopclose">取消</view>
		</uni-popupt>
		<!-- loading 遮罩层 -->
		<loading v-if="loadflag"></loading>
		<navigation></navigation>
	</view>
</template>

<script>
import particulars from '@/pageA/competiondetail/particulars.vue';
import comment from '@/pageA/competiondetail/comment.vue';
import photo from '@/pageA/competiondetail/photo.vue';
// 任务报名的弹出层
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import uniPopupt from '@/components/uni-popupt/uni-popup.vue';
import loading from '@/components/loading/loading.vue';
import navigation from '@/components/navigation/navigation.vue';
import h5Copy from '@/js_sdk/junyi-h5-copy/junyi-h5-copy.js';
export default {
	onShareAppMessage(res) {
		var herf =  window.location.href;
		if (res.from === 'button') {
			// 来自页面内分享按钮
			// //  // console.log (res.target);
		}
		return {
			title: this.active_info.name,
			path: href
		};
	},
	components: {
		particulars,
		comment,
		photo,
		uniPopup,
		uniPopupt,
		loading,
		navigation
	},
	data() {
		return {
			loadflag: true,
			navList: [{ name: '详情' }, { name: '相册' }, { name: '评论' }],
			border_index: 0,
			title: '活动详情',
			shr: 0,
			service_list: ['超级豪华单间服务', '50人大巴服务'],
			service_index: 10,
			// 组别列表
			group_list: [],
			group_index: 10,
			active_id: '',
			currentpage: '1',
			active_info: {},
			// 报名需要的金额
			singup_money: '',
			grouplist_id: '',
			singup_flag: false,
			// 当前时间戳
			nowTime: '',
			singup_start_time: '', //报名开始时间戳
			singup_end_time: '', //报名结束时间戳
			start_time: '', //比赛开始时间戳
			vip_rank: '', // 判断会员等级
			price_flag: '', // 判断显示价格
			singupPeople: [],
			singupPeople_people: '',
			ac_status: '', //根据活动 赛事来变化
			sinup_people: 0, // 活动的总报名人数
			type: '', // 当前活动类型
			numOfPeople: false,
			headImg: '',
			locationHref: '',
			limitPeople: 0 ,//参加活动的总人数
			peopleWidth: '' // 小程序宽度不显示
		};
	},

	onLoad(options) {
		// 活动id
			this.active_id = options.id;
		// #ifdef H5
			this.locationHref = window.location.href;
		// #endif
	
	},
	mounted() {
	// #ifdef MP-WEIXIN
	var pages = getCurrentPages();
	var page = pages[pages.length - 1];
	console.log('111')
	console.log(page)
	console.log(page.options.id);
	this.locationHref = page.route+'?id='+page.options.id
	// #endif
	
		this.getactiveInfo();
		this.getgroupInfo();
		// 判断用户有没有报名权限
		this.nowTime = new Date().getTime();
		this.getsingupPeople();
		this.getUserInfo();
		// this.getsingupPeople();
	},
	methods: {
		// h5复制链接
		// #ifdef H5
			copy() {
				let content = this.locationHref; // 复制内容，必须字符串，数字需要转换为字符串
				const result = h5Copy(content);
				if (result === true) {
					uni.showToast({
						title: '复制成功'
					});
				} else {
					uni.showToast({
						title: '复制失败',
						icon: 'none'
					});
				}
			},
		// #endif
		// #ifdef MP-WEIXIN
		copy () {
			let content = this.locationHref; // 复制内容，必须字符串，数字需要转换为字符串
			uni.setClipboardData({
			    data: content,
			    success: function () {
			        // console.log('success');
					uni.showToast({
						title: '复制成功'
					});
			    }
			});
		},
		// #endif
		// 获取用户信息
		getUserInfo() {
			this.ajax('user/userInfo', {
				success: res => {
					 // console.log (res);
					this.headImg = res.msg.Avatar.replace("http:","https:");
				}
			});
		},
		// h5分享微信好友
		shareFriend() {
			// //  // console.log (123);
			const versionFlag = uni.getSystemInfoSync().version;
			if (!versionFlag) {
				this.toast('分享按钮在右上角');
			}
		},
		// 待支付状态调往 订单列表
		toorderpay() {
			uni.navigateTo({
				url: '/pageC/mine/register?state=' + '1'
			});
		},
		// 获取参加报名的活动成员
		getsingupPeople() {
			this.ajax('active/activeSignInfo', {
				data: {
					active_id: this.active_id,
					page: '1'
				},
				success: res => {
					 // console.log (res);
					res.msg.forEach( item => {
						this.limitPeople = this.limitPeople + item.sign_num
						if(item.head_url) {
							item.head_url = item.head_url.replace("http:","https:")
						}
					})
					this.singupPeople = res.msg.slice(0, 5);
					this.peopleWidth = this.singupPeople.length *30 + 'px'
					this.singupPeople_people = res.msg.length;
					if (this.singupPeople_people == 0) {
						this.singupPeople_people = '0';
					}
					 // console.log (this.singupPeople.length);
				}
			});
		},
		// 获取活动的基本信息
		getactiveInfo() {
			this.ajax('active/activeBaseInfo', {
				data: { id: this.active_id },
				success: res => {
					res.msg.create_time_m = res.msg.create_time.split(' ')[0];
					res.msg.end_time_m = res.msg.end_time.split(' ')[0];
					res.msg.end_time_b = res.msg.end_time.slice(0, res.msg.start_time.length - 3);
					res.msg.sign_up_end_m = res.msg.sign_up_end.split(' ')[0];
					res.msg.sign_up_start_m = res.msg.sign_up_start.split(' ')[0];
					res.msg.start_time_m = res.msg.start_time.split(' ')[0];
					res.msg.start_time_b = res.msg.start_time.slice(0, res.msg.start_time.length - 3);
					res.msg.update_time_m = res.msg.update_time.split(' ')[0];
					res.msg.sign_up_start = res.msg.sign_up_start.replace(/-/g, '/');
					res.msg.sign_up_end = res.msg.sign_up_end.replace(/-/g, '/');
					res.msg.start_time = res.msg.start_time.replace(/-/g, '/');
					this.singup_start_time = new Date(res.msg.sign_up_start).getTime();
					this.singup_end_time = new Date(res.msg.sign_up_end).getTime();
					this.start_time = new Date(res.msg.start_time).getTime();
					 // console.log (res);
					if (res.msg.type == 1) {
						this.ac_status = '比赛开始';
						this.type = '比赛';
					} else if (res.msg.type == 2) {
						this.ac_status = '活动开始';
						this.type = '活动';
					} else {
						this.ac_status = '任务结束';
						this.type = '任务';
					}
					uni.setNavigationBarTitle({
						title: res.msg.name
					});
					res.msg.active_limit_n = res.msg.active_limit + 1;
					this.active_info = res.msg;
					this.jude_limit();
					setTimeout(() => {
						this.loadflag = false;
					}, 700);
				}
			});
		},
		// 获取组别信息
		getgroupInfo() {
			this.ajax('active/activeTeam', {
				data: {
					active_id: this.active_id
				},
				success: res => {
					//  // console.log (res);
					// 遍历获取有几个not_null 为true
					res.msg.forEach(item => {
						if (this.active_info.type != 1 && this.vip_rank != 2) {
							this.singup_money = item.normal_price;
						} else if (this.active_info.type != 1 && this.vip_rank == 2) {
							this.singup_money = item.vip_price;
						}
						(item.people = []), //  // console.log (item);
						// 判断总的报名人数
						this.sinup_people += item.total_people;
						item.allpeople_num = item.form.length;
						item.form.forEach(items => {
							// //  // console.log (items)
							if (items.not_null) {
								item.people = item.people.concat(items);
							}
						});
						item.people_num = item.people.length;
					});
					this.group_list = res.msg;
				}
			});
		},
		// 判断用户有没有权限进行报名
		jude_limit() {
			this.ajax('Order/getOrderLimit', {
				data: {
					active_id: this.active_info.id
				},
				success: res => {
					 // console.log (res);
					if (res.code) {
						this.vip_rank = res.msg;
					} else {
						this.toast('获取会员信息失败');
					}
				}
			});
		},
		//判断当前时间不能报名
		issingup() {
			// //  // console.log (this.group_list[this.group_index])
			// 获取当前的时间戳
			const nowTime = new Date().getTime();
			// //  // console.log (nowTime)
			// 报名开始的时间戳
			const singupTime = new Date(this.active_info.sign_up_start).getTime();
			// 报名截止的时间戳
			const singupendTime = new Date(this.active_info.sign_up_end).getTime();
			// 判断报名按钮的时间戳
			if (nowTime >= singupTime && singupendTime > nowTime && this.group_index != 10) {
				this.singup_flag = true;
				//  // console.log (this.singup_flag);
			} else {
				this.singup_flag = false;
			}
		},
		// 选择组别
		changegroup(key, id) {
			uni.showLoading({
				title: '检测报名状态'
			});
			this.grouplist_id = id;
			// 选中了那个服务
			this.group_index = key;
			var group = this.group_list[key];
			//  // console.log (this.active_id, group.id);
			this.ajax('active/checkTeamNum', {
				data: {
					active_id: this.active_id,
					team_id: group.id
				},
				success: res => {
					uni.hideLoading();
					 // console.log (res);
					if (!res.code) {
						this.numOfPeople = true;
					} else {
						this.numOfPeople = false;
					}
				}
			});
			// if(group.people_num == group.total_people) {
			// 	this.numOfPeople = true
			// 	//  // console.log (this.numOfPeople);
			// }else {
			// 	this.numOfPeople = false
			// }
			//  // console.log (group);
			this.issingup();
			if (group.is_shift && this.nowTime > this.singup_start_time && this.nowTime < group.shift_time * 1000) {
				this.singup_money = group.shift_price;
			} else if ((group.is_shift && this.vip_rank == 2 && this.nowTime > group.shift_time * 1000) || (!group.is_shift && this.vip_rank == 2)) {
				this.singup_money = group.vip_price;
			} else {
				this.singup_money = group.normal_price;
			}
			if (this.singup_money == '0.00') {
				this.singup_money = '免费';
			}
			//  // console.log (this.singup_money);
		},
		// 选择服务
		// choosefw(key) {
		// 	if (key == this.service_index) {
		// 		this.service_index=10
		// 	}else {
		// 		this.service_index = key
		// 	}
		// },
		tosociety() {
			uni.navigateTo({
				url: '/pageA/competiondetail/society'
			});
		},
		// 查看地图位置
		tolookmap(latitude, longitude) {
			 // console.log (latitude,longitude);
			// uni.navigateTo({
			// 	url: '/pageA/competiondetail/lookmap?latitude=' + latitude + '&longitude=' + longitude
			// });
			uni.openLocation({
				longitude: +longitude,
				latitude: +latitude,
			})
		},
		todiscuss(key) {
			uni.navigateTo({
				url: '/pageA/competiondetail/discuss?active_id=' + key + '&runname=' + this.active_info.club_name
			});
		},
		// 去往相册详情页面
		tophotodetail(e) {
			uni.navigateTo({
				url: '/pageA/competiondetail/photodetail?id=' + e
			});
		},
		// 去往活动  任务结果页面
		torwresult() {
			// uni.navigateTo({
			// 	url:'/pageA/competiondetail/detail?id='+key
			// })
			uni.navigateTo({
				url: '/pageA/competiondetail/detail?active_id=' + this.active_id
			});
		},
		// 活动统计页面
		totask() {
			uni.navigateTo({
				url: '/pageA/competiondetail/activeprocess?active_id=' + this.active_id
			});
		},
		check(key) {
			this.border_index = key;
		},
		tosingup() {
			// uni.navigateTo({
			// 	url:'../singup/singupchoose',
			// })
			if (this.active_info.type == 1) {
				this.$refs.popup.open();
			} else {
				uni.navigateTo({
					url: '/pageB/singup/singupmessage?id=' + 0 + '&active_id=' + this.active_id + '&price=' + this.singup_money
				});
			}
		},
		// 生成朋友圈海报
		tofriendban(key) {
			// uni.navigateTo({
			// 	url:'/pages/share/share',
			// })
			uni.navigateTo({
				url: '/pageA/competiondetail/friendbanner?activeid=' + key
			});
		},
		// 跳转到分享页面
		toshare() {
			this.$refs.sharepopup.open();
		},
		sharepopclose() {
			this.$refs.sharepopup.close();
		},
		// 跳转到报名人员列表
		toparticipant(type) {
			if (this.singupPeople_people <= 0) return this.toast('还没有人参加活动');
			uni.navigateTo({
				url: '/pageB/participant/participant?id=' + this.active_id + '&type=' + type
			});
		},
		tograde() {
			uni.navigateTo({
				url: '/pageA/grade/grade?id=' + this.active_id + '&activeName=' + this.active_info.name
			});
		},
		// 去往任务报名信息模块
		tosingupmessage(key, id, price) {
			var reduisePeople = this.sinup_people - this.limitPeople
			 // console.log (reduisePeople);
			// uni.navigateTo({
			// 	url:'/pageC/singup/singupmessage',
			// })
			uni.navigateTo({
				url: '/pageB/singup/singupmessage?id=' + id + '&active_id=' + key + '&price=' + price + '&reduisePeople='+reduisePeople
			});
		}
	}
};
</script>

<style lang="less" scoped>
@import url('../../static/less/pageA/competiondetail/competitiondetail.less');
</style>
<style>
page {
	background-color: #ffffff;
	padding-bottom: 110upx;
	box-sizing: border-box;
}
</style>
